<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<!DOCTYPE HTML>
<html>
	
  <head>
    
    <title>选择商品</title>
    


<style>
	<!--
	table {
	table-layout: fixed;
	word-wrap:break-word;
	}
	td{
		
		word-break:break-all;
	}
	
	}
	//-->
</style>
<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/manual.css">
  </head>
  <base target="_self"></base>
  <body>
    <table  width="100%"  border="0" cellpadding="0" cellspacing="0" height="100%">
  	
  	<tr valign="top">
  		<td>
  			<table width="100%"  border="0" cellpadding="0" cellspacing="0">
  
 <tr>
    	
    	<td width="100%">
    		<FONT size="6">选择商品</FONT> 
    		
    		
    	</td>
    </tr>
    
    <tr>
    	
     	
     	
     	<td valign="top" >
     <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
    	 <tr>
     		<td>
     	<table width="100%" height="100%" border="0" cellpadding="0" bgcolor="#e5f3ff" cellspacing="0" style= "border:1px solid #ffffff; border-top-color:#6cb1f1;">
     		
     		<tr>
     			<td>商品信息
     			<input type="button" value="查看谁有权限" 
     				onclick="javascript:openUrlForDialog('selectoperatorlimitedAction_background.action?limitedCode=<s:property value="limitedcode"/>')"/>
     			</td>
     		</tr>
     	</table>
     	</td>
     		</tr>
 <tr>
     		<td>
    	
			<table  border="0" >
				<tr>
				  <td>
					  查找产品:<input type="text" name="dialogSearchStr" id="dialogSearchStr" size="30" value="<s:property value="searchStr"/>"/>
					  <input type="button" onclick="javascript:openUrlForDialog('insertpurchaseinfo_warehouse.action?searchStr='+$('#dialogSearchStr').attr('value'))" value="查找" />
				  </td>
				  
				  
			  </tr>
			</table>
	</td>
     		</tr>
     		 <tr>
     		<td>
     		
		<table align="left"  border="0"  cellspacing="0" cellpadding="0" style= "border:1px solid #ffffff; border-bottom-color:#21a4dc;
    border-left-color:#21a4dc;border-right-color:#21a4dc;border-top-color:#21a4dc">
    	<tr>
   			
   			<td>产品ID</td>
   			<td width="305">产品名称</td>
   			<td>数量</td>
   			<td>单位</td>
   			<td>均价</td>
   			<td>最新进价</td>
   			<td>先择</td>
   		</tr>
   	<s:iterator id="goodsList" value="goodsList" status="sta">
   		<tr>
   			
   			<td><s:property value="#goodsList.id_goods"/></td>
   			
   			
   			
   				<td>
   				<a href="javascript:choseGoods('<s:property value="#goodsList.id_goods"/>','<s:property value="#goodsList.name_goods"/>','<s:property value="#goodsList.unit_goods"/>');"><s:property value="#goodsList.name_goods"/></a>
   				
   				
   				
   				</td>
   			
   	
   			<td><s:property value="#goodsList.number_goods"/></td>
   			<td><s:property value="#goodsList.unit_goods"/></td>
   			<td><s:property value="#goodsList.average_goods"/></td>
   			<td><s:property value="#goodsList.price_goods"/></td>
   			
   				<td><button onclick="choseGoods('<s:property value="#goodsList.id_goods"/>','<s:property value="#goodsList.name_goods"/>','<s:property value="#goodsList.unit_goods"/>');" >选择</button></td>
   			
   			
   		</tr>
     		
    </s:iterator>
     		
     		
     	</table>
     	
     	</td>
     	</tr>
     	<tr>
     		<td>
     				<table width="100%" border="0" cellpadding="0" bgcolor="" cellspacing="0" >
				<tr >
					<td >
						<%
						
						String url = "insertpurchaseinfo_warehouse.action";
						int pageSize = (Integer) request.getAttribute("pageSize");
						int beginPageNum =  (Integer) request.getAttribute("beginPageNum");
						int countRow =  (Integer) request.getAttribute("rowNum");
					    int countPage =(countRow-1)/pageSize+1;
					    int currentPage = countPage - (countRow-beginPageNum)/pageSize;
					    
					    
					    
					 	 
					    
					    String searchstr = (String)request.getParameter("searchStr");//*/
					    if(searchstr != null){
					    	searchstr = java.net.URLDecoder.decode(searchstr, "UTF-8");
					    	//searchstr = java.net.URLEncoder.encode(searchstr,"UTF-8");
					    	//searchstr = searchstr.replaceAll("%", "%25");
					    }else{
					    	searchstr = "";
					    }
					    
					    if((beginPageNum-pageSize+1) >= 1){%>
				    	<a href="javascript:openUrlForDialog('<%=url %>?searchStr=<%=searchstr %>&beginPageNum=<%=(beginPageNum-pageSize) %>')">
								上一页 </a>
				   <% }
					    
					    //beginPageNum =  (pageNum - 1) * pageSize;
						StringBuffer chagePageBuff = new StringBuffer();
						if(countPage >= 2){ 
							int begin = currentPage - 9;
							int end = currentPage + 9;
							
							if(begin < 1){
								begin = 0;
							}
							if(end > countPage){
								end = countPage-1;
							}
							
							
							for(int i=begin;i<countPage;i++){
								
								
								
								
								
								if(beginPageNum == i*pageSize){
									%>
									<%=i+1 %>
									<%
								}else{
									%>
									<a href="javascript:openUrlForDialog('<%=url %>?searchStr=<%=searchstr %>&beginPageNum=<%=i*pageSize %>')">
									[<%=i+1 %>] </a>
									<%
								}
								
								if(i > end){
									
									break;
									
								}
							}
						}
						
						if((beginPageNum+pageSize-countRow) < 0){%>
				    	<a href="javascript:openUrlForDialog('<%=url %>?searchStr=<%=searchstr %>&beginPageNum=<%=(beginPageNum+pageSize) %>')">
								下一页 </a>
				   		<% }
						%>

					</td>

				</tr>
				
	</table>
     		
     		</td>
     	
     	</tr>
     	
     	
     	<tr>
     	
	     	<td>
	     		
	     	</td>
	     	</tr>
     	
     	</table>
     	
     	 
	</td>
</tr>
</table>
  		
  		</td>
  	</tr>
  	
  	
  	
  </table>

  
  </body>
  
</html>
